<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <title>显示文本框</title>
</head>

<body>
    <div id="app">
        <input v-model="text">
        <button @click="showText">显示内容</button>
    </div>
    <script>
        const App = {
            data() {
                return {
                    text: ''
                }
            },
            methods: {
                showText() {
                    alert(this.text);
                }
            }
        };
        Vue.createApp(App).mount('#app');
    </script>
</body>

</html>